using System;
using Cysharp.Threading.Tasks;
using System.Threading.Tasks;
using Unity.Mathematics;
using UnityEditor;
using UnityEngine;
using QFramework;
using M13.Base;
using M13.Phys;

public enum OperateKey
{
    L,R
}

namespace M13.Game.Entity
{
    /// <summary>
    /// 操作键：
    /// 0：L、鼠标左键
    /// 1：R、鼠标右键
    /// </summary>
    
    
    /// <summary>
    /// 接口：可以被操作的，被entity\ entityBlock\ block继承
    /// </summary>
    public interface IOperable
    {
        bool CanOperate(OperateKey key, Item.Item item);
        void Operate(OperateKey key, Entity op);
        void Operate(OperateKey operateKey, Entity op, Item.Item item);
    }
    
    public class Entity : MonoBehaviour, IController, IOperable
    {
        public int HealthPointsCap { get; protected set; }
        public int CurrentHealthPoints { get; protected set; }
        public int AttackValue { get; protected set; }
        
       
        public const float Gravity = 9.8f;

        public AABBCollider _collider;
        
        private bool _isInvincibleFrame;

        private CollisionFlags _collisionFlags;

        private void Awake()
        {
            _collider = this.GetComponent<AABBCollider>();
        }

        private void Start()
        {
            
        }

        protected virtual void OnDie() { }

        protected virtual void FixedUpdate()
        {
            
        }

        public virtual bool CanOperate(OperateKey key, Item.Item item)
        {
            return false;
        }

        public virtual void Operate(OperateKey key, Entity op)
        {
            
        }

        public virtual void Operate(OperateKey operateKey, Entity operatorEntity, Item.Item item)
        {
            
        }

        

        public IArchitecture GetArchitecture()
        {
            return GameArchitecture.Interface;
        }
    }
}